Repository navigation
Make Adafactor relative-step constants configurable - #549
Open
shaneraphel wants to merge 3 commits into
Open
shaneraphel wants to merge 3 commits into
shaneraphel wants to merge 3 commits into
Conversation
get_trace averaged the Hessian diagonal over the spatial dims only for 4D kernels. Conv1d (3D) and Conv3d (5D) weights left tmp_output unbound. Average over dims 2..ndim-1 instead; 4D is unchanged.
Each mode factor of an order-k tensor enters to the power -1/(2k): -1/4 per side for matrices. The code used -1/k, twice the published exponent. The 7 pre-existing test_optimizer Shampoo failures are a state-dict precision issue on this torch version and fail identically without this change.
warmup_rate (default 1e-6) replaces the hard-coded warm-up slope and min_step_size (default 1e-2) the floor. Old checkpoints without the new group keys fall back to the old values. The 7 pre-existing test_optimizer Adafactor failures are a state-dict precision issue on this torch version and fail identically without this change.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_get_lrhard-coded the warm-up slope (1e-6) and the non-warmup floor (1e-2). They are nowwarmup_rate(default1e-6) andmin_step_size(default1e-2). Defaults reproduce the old schedule exactly; groups saved before these keys existed fall back to the old values instead of raisingKeyError. Negative values are rejected.Fixes #535.
Test plan
pytest tests/test_adafactor_step_size.py: 6 passed (defaults match the old formula, custom values take effect, old checkpoint keys, validation, end-to-end step)tests/test_optimizer.py -k Adafactorhas 7 failures that exist without this change (state-dict precision on this torch version)